
#include "GameEngine.h"

//(level 1 code)

class WindowsInput : public IInput
{
    friend class GameComponentFactory;
    
    bool m_bOldKeys[256];			//Old state of all the keys
	bool m_bKeys[256];				//State of all the keys
	Vector m_vMousePos;			    //Position of the mouse
	Vector m_vMouseOldPos;          //Old position of the mouse
	Vector m_vMouseVector;          //Vector of last mouse movement
	Scalar m_fMouseDistance;		//Distance the mouse moved
	Scalar m_fMouseAngle;			//Direction the mouse moved in
    
private:
    
    WindowsInput(Game* pOwner) : IInput(pOwner)         {}
    ~WindowsInput()      {}
    
    //Gathers all of the input data
	virtual void update();
    
public:
    
	//Mouse movement
	virtual Vector 	getMousePos() 				{ return m_vMousePos; }
	virtual Vector	getMouseMoveVector() 		{ return m_vMouseVector; }
	virtual Scalar	getMouseMoveAngle()			{ return m_fMouseAngle; }
	virtual Scalar 	getMouseMoveDistance()		{ return m_fMouseDistance; }
	virtual bool 	isMouseMoved()				{ return m_fMouseDistance; }
    
	//Key presses (includes mouse clicks)
	virtual bool getKeyState(Key k)				{ return m_bKeys[k]; }
	virtual bool getKeyDown(Key k)				{ return (!m_bOldKeys[k] && m_bKeys[k]); }
	virtual bool getKeyUp(Key k)				{ return (m_bOldKeys[k] && !m_bKeys[k]); }
    
};
